home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / GSAVE2.ZIP / C_PLUS.ZIP / GLOAD2.C < prev    next >
C/C++ Source or Header  |  1995-12-22  |  1KB  |  68 lines

  1. //Wow, my first C++ program! by Earwax!
  2.  
  3. //Its so slow cause i think its reading eery pixel seperately, also cause
  4. //i couldn't figure out how to get "malloc" working properly etc.
  5.  
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8.  
  9. void load_gs_file(void)
  10. {
  11.    FILE *gs_file;
  12.    unsigned char palette[768], pixel;
  13.  
  14.     if ((gs_file = fopen("\SCREENGS.000", "rb")) == NULL)
  15.         {
  16.             asm     mov     ax,0003h
  17.             asm     int     10h
  18.         printf("Error opening SCREENGS.000!\n");
  19.         exit(0);
  20.         }
  21.  
  22.     fread(palette,1,768,gs_file);
  23.  
  24.     asm {
  25.         mov     dx,3c8h
  26.         xor     al,al
  27.         out     dx,al
  28.         inc     dx
  29.         mov     cx,768
  30.         lea     si,palette
  31.         }
  32. load_colors:
  33.         asm     lodsb
  34.         asm     out     dx,al
  35.         asm     loop    load_colors
  36.  
  37.         asm     mov     cx,64000
  38.         asm     xor     di,di
  39.         asm     mov     ax,0a000h
  40.         asm     mov     es,ax
  41. load_picture_loop:
  42.         asm     push    cx
  43.     pixel = fgetc(gs_file);
  44.         asm     pop     cx
  45.     _AL=pixel;
  46.         asm     stosb
  47.         asm     loop    load_picture_loop
  48.  
  49. fclose(gs_file);
  50.  
  51. }
  52.  
  53. int main()
  54. {
  55.         asm     mov     ax,0013h
  56.         asm     int     10h
  57.  
  58.     load_gs_file();
  59.  
  60.         asm     xor     ah,ah
  61.         asm     int     16h
  62.         asm     mov     ax,0003h
  63.         asm     int     10h
  64.     printf("Stoopid C loading routines for SCREENGS.??? files\n");
  65.     printf("(S)toopidright Earwax!\n");
  66.     return(0);
  67. }
  68.